Work around internal error in some versions of x86/64 gcc
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 21 Oct 2005 10:29:51 +0000 (11:29 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 21 Oct 2005 10:29:51 +0000 (11:29 +0100)
by manually hoisting gdt address calculation outside loop.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain.c
xen/arch/x86/setup.c

index 7d61eadfab19c48ef81245b8bb98e890ab183e2e..c52448d2fd790a1b38034d7cea0298f5f8e5999f 100644 (file)
@@ -254,6 +254,7 @@ void free_perdomain_pt(struct domain *d)
 void arch_do_createdomain(struct vcpu *v)
 {
     struct domain *d = v->domain;
+    l1_pgentry_t gdt_l1e;
     int vcpuid;
 
     if ( is_idle_task(d) )
@@ -282,12 +283,10 @@ void arch_do_createdomain(struct vcpu *v)
      * GDT, and the old VCPU# is invalid in the new domain, we would otherwise
      * try to load CS from an invalid table.
      */
+    gdt_l1e = l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
     for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
-    {
         d->arch.mm_perdomain_pt[
-            (vcpuid << PDPT_VCPU_SHIFT) + FIRST_RESERVED_GDT_PAGE] =
-            l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
-    }
+            (vcpuid << PDPT_VCPU_SHIFT) + FIRST_RESERVED_GDT_PAGE] = gdt_l1e;
 
     v->arch.guest_vtable  = __linear_l2_table;
     v->arch.shadow_vtable = __shadow_linear_l2_table;
index 388735fb491ad0f258ec47eefdcdcf81f42f49bc..21e4bb810b82c247de2e0de42edd088d6f94f68c 100644 (file)
@@ -141,7 +141,7 @@ static void __init do_initcalls(void)
 static void __init start_of_day(void)
 {
     int i;
-    unsigned long vgdt;
+    unsigned long vgdt, gdt_pfn;
 
     early_cpu_init();
 
@@ -164,10 +164,10 @@ static void __init start_of_day(void)
      * noted in arch_do_createdomain(), we must map for every possible VCPU#.
      */
     vgdt = GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE;
+    gdt_pfn = virt_to_phys(gdt_table) >> PAGE_SHIFT;
     for ( i = 0; i < MAX_VIRT_CPUS; i++ )
     {
-        map_pages_to_xen(
-            vgdt, virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR);
+        map_pages_to_xen(vgdt, gdt_pfn, 1, PAGE_HYPERVISOR);
         vgdt += 1 << PDPT_VCPU_VA_SHIFT;
     }